package com.ziiwee.reduce.rest;

import com.ziiwee.reduce.rest.condition.Condition;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.Map;

public interface ResourceService<T extends Resource<ID>, ID> {

    default Page<T> findAll(Pageable pageable, Condition condition) {
        throw new ResourceServiceNotFindException("该资源不支持此操作");
    }

    default T findOne(ID id) {
        throw new ResourceServiceNotFindException("该资源不支持此操作");
    }

    default T create(T t) {
        throw new ResourceServiceNotFindException("该资源不支持此操作");
    }

    default T update(ID id, Map<String, Object> parameters) {
        throw new ResourceServiceNotFindException("该资源不支持此操作");
    }

    default void delete(ID id) {
        throw new ResourceServiceNotFindException("该资源不支持此操作");
    }

}
